from django.db import models
from django.contrib.auth.models import AbstractUser
from utils.base import Base
# Create your models here.


class Vip(Base):

    title = models.CharField('vip名称',max_length=64,null=True)

    level = models.IntegerField('vip等级',default=1)

    desc = models.CharField('vip描述',max_length=200,null=True)

    class Meta:
        db_table = 'tb_vip'

class User(AbstractUser):
    phone = models.CharField('手机号',max_length=11)
    img = models.ImageField(upload_to='user',null=True)
    nick_name = models.CharField('昵称',max_length=20)
    address = models.CharField('地址',max_length=255)
    # vip外键
    vip = models.ForeignKey(Vip,on_delete=models.SET_NULL,null=True)
    # vip到期时间
    past_due_time = models.DateTimeField(null=True)

    class Meta:
        db_table = 'tb_user'


